<script setup>
    import { onMounted, ref } from "vue";

    const message = ref('Hello Vue 3!');
    // const res = ref(await window.myApi.loadText());

    onMounted(async () => {
        const res = await window.myApi.loadText();
        console.log(res);
        localStorage.setItem("key", JSON.stringify(res))
        message.value = res;
    })

    function createCopyWindow() {
      window.myApi.createCopyWindow();
    }

    function closeCopyWindow() {
      window.myApi.closeCopyWindow();
    }

    function sendMessage() {
      window.myApi.sendMessage();
    }
</script>

<template>
  <div>
    {{ message }}
    <button @click="createCopyWindow()">创建窗口</button>
    <button @click="closeCopyWindow()">关闭窗口</button>
    <button @click="sendMessage()">发送消息</button>
  </div>
</template>

<style scoped>
</style>
